<?php

class Main extends Controller {
	
	function Main()
	{
		parent::Controller();	
	}
	
	function index()
	{
		$this->load->helper('form');
		$prefs = array('day_type' => 'short');
		$this->load->library('calendar', $prefs);
		
		$data['title'] = "GCMS";
		$data['heading'] = "Dashboard";
		$data['style'] = base_url().'system/application/views/content.css';
		
		$data['header'] = $this->load->view('header', $data, true);
		$data['footer'] = $this->load->view('footer', $data, true);
		$this->_login_check($data, 'main_view');
	}	
	
	function _login_check($data, $dest)
	{
		$this->load->library('session');
		
		$logged_in = $this->session->userdata('logged_in');
		if(!$logged_in){
			$this->load->view('login', $data);
		} else {
			$this->load->view($dest, $data);
		}
	}
}
?>